#include "StdAfx.h"
#include "PDAfederateAmbassador.h"
#include <iostream>

using namespace std;
using namespace rti1516;

extern void appendText(const wchar_t* text);

PDAfederateAmbassador::PDAfederateAmbassador(void)
{
}

PDAfederateAmbassador::~PDAfederateAmbassador(void)
{
}

void printAttrValues()
{
   //AttributeHandleValueMap::const_iterator iter;

   //for (iter = attrVals.begin(); iter != attrVals.end(); iter++)
   //{
   //   wcout << iter->first.toString().c_str() << L" "
   //         << DtToWString((char*)iter->second.data()).c_str() << endl;
   //}
}

void printParamValues()
{
   //ParameterHandleValueMap::const_iterator iter;

   //for (iter = paramVals.begin(); iter != paramVals.end(); iter++)
   //{
   //   wcout << iter->first.toString().c_str() << L" "
   //         << DtToWString((char*)iter->second.data()).c_str() << endl;
   //}
}

void PDAfederateAmbassador::objectInstanceNameReservationSucceeded(
   std::wstring const & theObjectInstanceName)
{
	appendText(theObjectInstanceName.c_str());
   wcout << L"objectInstanceNameReservationSucceeded: "
         << theObjectInstanceName.c_str() << endl;

}

void PDAfederateAmbassador::objectInstanceNameReservationFailed(
   std::wstring const & theObjectInstanceName)
{
   wcout << L"objectInstanceNameReservationFailed: "
         << theObjectInstanceName.c_str() << endl;

}

void PDAfederateAmbassador::discoverObjectInstance (
   std::wstring const & theObjectInstanceName)
{
	appendText(theObjectInstanceName.c_str());
   //wcout << L"discoverObjectInstance: "
   //      << theObjectInstanceName.c_str();
}

void PDAfederateAmbassador::reflectAttributeValues (std::wstring const & theObjectInstanceName)
{
	appendText(theObjectInstanceName.c_str());
}

void PDAfederateAmbassador::receiveInteraction()
{
   //wcout << L"receiveInteraction: "
   //      << theInteraction.toString() << L" "
   //      << DtToWString(tag)  << L" "
   //      << (sentOrder == RECEIVE ? L"RECEIVE " : L"TIMESTAMP ")
   //      << (theType == RELIABLE ? L"RELIABLE " : L"BEST_EFFORT ")
   //      << theTime.toString() << L" "
   //      << (receivedOrder == RECEIVE ? L"RECEIVE " : L"TIMESTAMP ")
   //      << L"#regions: " << theSentRegionHandleSet.size() << L" "
   //      << L"#parameters: " << theParameterValues.size() << endl;

   //printParamValues(theParameterValues);
}

 void PDAfederateAmbassador::removeObjectInstance()
 {
   //const char* tag = theUserSuppliedTag.size()
   //   ? (const char*)theUserSuppliedTag.data() : "";

   //wcout << L"removeObjectInstance: "
   //      << myData.objectInstanceMap[theObject].c_str() << L"("
   //      << theObject.toString().c_str() << L") "
   //      << DtToWString(tag)  << L" "
   //      << (sentOrder == RECEIVE ? L"RECEIVE " : L"TIMESTAMP ")
   //      << theTime.toString().c_str() << L" "
   //      << (receivedOrder == RECEIVE ? L"RECEIVE " : L"TIMESTAMP ")
   //      << theHandle.toString().c_str()  << endl;
}

